package com.markerhub.controller;


import com.markerhub.common.lang.Result;
import com.markerhub.entity.User;
import com.markerhub.service.UserService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;


    @RequiresAuthentication//必须登录认证才能访问的注解
    @GetMapping("/index")
    public  Result index(){
        User user = userService.getById(1);
        return Result.succ(user);
    }


    @PostMapping("/save")
    public  Result save(@Validated @RequestBody User user){
        System.out.println("1231");
        return Result.succ(user);

    }



}
